import { domainService } from '~/config/server'
import { NetService } from '~/utils/net.service'
import { Inject, Debounce } from "~/core/decorator";
import { FilterService } from '~/utils/filter.service';
export class ReportManageService {

  @Inject(NetService)
  private netService: NetService

  /**
   * 回款统计查询
   */
  public getAllRepaymentReportData(data) {
    return this.netService.send({
      server: domainService.reportController.getAllRepaymentReportData,
      data
    })
  }
  /**
   * 每日催收统计
   */
  public queryCollectDataDays(data) {
    const params = { ...data }
    params.queryDateMin = FilterService.dateRanageFormat(data.queryDate).start
    params.queryDateMax = FilterService.dateRanageFormat(data.queryDate).end
    delete params.queryDate
    return this.netService.send({
      server: domainService.reportController.queryCollectDataDays,
      data: params
    })
  }
  /**
   * 委外催收明细
   * @param data 
   */
  public queryOuterData(data){
    return this.netService.send({
      server: domainService.reportController.queryOuterData,
      data
    })
  }
  /**
   * 回款率报表
   */
  public queryMoneyBackRate(data){
    const params={...data}
    console.log(data.queryDate,'params')
    params.queryDateMin=FilterService.dateRanageFormat(data.queryDate).start
    params.queryDateMax=FilterService.dateRanageFormat(data.queryDate).end
    params.overdueDaysMax= data.overdueDays.max
    params.overdueDaysMin= data.overdueDays.min
    return this.netService.send({
      server:domainService.reportController.queryMoneyBackRate,
      data:params
    })
  }
  /**
   * 回退率报表
   */
  public queryCaseReturnRate(data){
    return this.netService.send({
      server:domainService.reportController.queryCaseReturnRate,
      data
    })
  }
  /**
   * 五级分类催收回款率报表
   */
  public queryFiveLevelData(data){
    return this.netService.send({
      server:domainService.reportController.queryFiveLevelData,
      data
    })
  }
  /**
   * 核销坏账明细报表
   */
  public getVerifyInfoReport(data,page){
    return this.netService.send({
      server:domainService.reportController.getVerifyInfoReport,
      data,
      page
    })
  }
  /**
   * 导出委外催收明细报表
   */
  public exportOuterData(data){
    return this.netService.send({
      server:domainService.reportController.exportOuterData,
      data
    })
  }
  /**
   * 导出核销案件明细报表
   */
  public exportVerifyInfoReport(data){
    return this.netService.send({
      server:domainService.reportController.exportVerifyInfoReport,
      data
    })
  }
  /**
   * 导出五级分类报表
   */
  public exportFiveLevelData(data){
    return this.netService.send({
      server:domainService.reportController.exportFiveLevelData,
      data
    })
  }
  /**
   * 导出回款率报表
   */
  public exportMoneyBackRate(data){
    const params={...data}
    params.queryDateMin=FilterService.dateRanageFormat(data.queryDate).start
    params.queryDateMax=FilterService.dateRanageFormat(data.queryDate).end
    return this.netService.send({
      server:domainService.reportController.exportMoneyBackRate,
      data:params
    })
  }
  /**
   * 导出还款明细报表
   */
  public exportRepaymentRecord(data){
    return this.netService.send({
      server:domainService.reportController.exportRepaymentRecord,
      data: {
        deptCode: data.deptCodes,
        collectorId: data.collectorId,
        ids:data.ids,
        caseType: data.caseType ? data.caseType : undefined,
        sysCode: data.sysCode ? data.sysCode : undefined,
        caseNumber:data.caseNumber ? data.caseNumber : undefined,
        personalName:data.personalName ? data.personalName : undefined,
        repaymentTimeMin:data.repaymentTime ? FilterService.dateRanageFormat(data.repaymentTime).start : undefined, // 案件流入时间
        repaymentTimeMax: data.repaymentTime ? FilterService.dateRanageFormat(data.repaymentTime).end : undefined
      }
    })
  }
  /**
   * 导出每日催收统计报表
   */
  public exportCollectDataDays(data){
    const params = { ...data }
    params.queryDateMin = FilterService.dateRanageFormat(data.queryDate).start
    params.queryDateMax = FilterService.dateRanageFormat(data.queryDate).end
    delete params.queryDate
    return this.netService.send({
      server:domainService.reportController.exportCollectDataDays,
      data:{
        collectorId:params.collectorId,
        deptCode:params.deptCode,
        queryDateMax:params.queryDateMax,
        queryDateMin:params.queryDateMin,
      }
    })
  }
  /**
   * 导出回退率报表
   */
  public exportCaseReturnRate(data){
    return this.netService.send({
      server:domainService.reportController.exportCaseReturnRate,
      data:{
        deptId:data.deptId,
        userId:data.userId
      }
    })
  }
  /**
   * 导出催收员回款明细报表
   */
  public exportAllRepaymentReportData(data){
    return this.netService.send({
      server:domainService.reportController.exportAllRepaymentReportData,
      data
    })
  }

}